﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 移除仓库组织多对多关系表 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SysOrgWarehouse");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "SysOrgWarehouse",
                columns: table => new
                {
                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrgId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    WarehouseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysOrgWarehouse", x => x.ID);
                    table.ForeignKey(
                        name: "FK_SysOrgWarehouse_SysOrg_OrgId",
                        column: x => x.OrgId,
                        principalTable: "SysOrg",
                        principalColumn: "ID");
                    table.ForeignKey(
                        name: "FK_SysOrgWarehouse_SysWarehouse_WarehouseId",
                        column: x => x.WarehouseId,
                        principalTable: "SysWarehouse",
                        principalColumn: "ID");
                });

            migrationBuilder.CreateIndex(
                name: "IX_SysOrgWarehouse_OrgId",
                table: "SysOrgWarehouse",
                column: "OrgId");

            migrationBuilder.CreateIndex(
                name: "IX_SysOrgWarehouse_WarehouseId",
                table: "SysOrgWarehouse",
                column: "WarehouseId");
        }
    }
}
